package lesson02;

import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class TestMain8 {

	public static void main(String[] args) {
		
		Collection<String> c1 = new LinkedList<>();
		c1.add("啊啊");
		c1.add("一");
		c1.add("五");
		
		System.out.println(c1.size()); // 3
		// 迭代器遍历
		Iterator<String> it = c1.iterator();
		while (it.hasNext()) {
			String item = it.next();
			System.out.println(item);
//			it.remove();
		}
		System.out.println("-------------");
		// Lambda 表达式： 函数式
		c1.forEach((item) -> {System.out.println(item);});
		
		// 
		System.out.println("-------------");
		for (String item: c1) {
			System.out.println(item);
		}
		System.out.println("-------------");
		List<String> list1 = new LinkedList<>();
		list1.add("aaaaa");
		list1.add(0, "bbb");
		
		for (int i = 0; i < list1.size(); i++) {
			String item = list1.get(i);
			System.out.println(item);
		}
		
		
		
	}
}
